#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	string s1, s2, s3;
	getchar();
	cin >> s1;
	getchar();
	cin >> s2;
	int k1, k2;
	k1 = s1.size();
	k2 = s2.size();
	int i1 = 0, i2 = 0;
	sort(s2.begin(), s2.end());
	while (k1 > 0 || k2 > 0) {
		if (k1 > 0 && k2 > 0 && s1[i1] > s2[i2] )
		{
			s3 += s2[i2++];
			k2--;
		}
		else if (k1 > 0 && k2 > 0 && s1[i1] <= s2[i2])
		{
			s3 += s1[i1++];
			k1--;
		}
		if (k1 == 0) {
			s3 += s2.substr(i2, s2.size());
			break;
		}
		else if (k2==0)
		{
			s3 += s1.substr(i1, s1.size());
			break;
		}
	}
	cout << s3;
	return 0;
}